package com.yc.mvc.bean;

import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.*;

@Data
public class Emp implements java.io.Serializable {

    @NotNull(message = "用户不能为空!") // name == null           空对象
    @NotEmpty(message = "用户不能为空!") // name.trim().isEmpty() 空字符串
    @Length(max = 20, min = 2, message = "姓名长度必须是2~20")
    String name;
    @NotNull()
    @NotEmpty()
    @Length(max = 12, min = 4)
    String pwd;
    @Range(min = 0, max = 200)
    Integer age;
    @Email(message = "邮箱地址格式错误!")
    String email;
    @Pattern(regexp = "1\\d{10}", message = "手机号码格式错误")
    String phone;

}
